<template>
    <view class="container" :style="'background-size: 100% auto; height: 100vh; background-image: url(+bgImage+); background-size: 100% auto; background-position: center center;'">
        <view class="logo-c">
            <image class="logo" mode="widthFix" :src="logo"></image>
        </view>
        <view class="huanying"></view>
        <view style="display: flex; justify-content: center">
            <user-statement-false
                @__l="__l($event, { eventOpts: [['^input', [['__set_model', ['', 'isCheckUserStatement', '$event', []]]]]] })"
                @input="__e($event, { eventOpts: [['^input', [['__set_model', ['', 'isCheckUserStatement', '$event', []]]]]] })"
                :data-event-opts="[['^input', [['__set_model', ['', 'isCheckUserStatement', '$event', []]]]]]"
                :value="isCheckUserStatement"
                vueId="6b4b36ba-1"
            ></user-statement-false>
        </view>
        <view class="button-c">
            <button @tap="__e" class="button" :data-event-opts="[['tap', [['getUserInfoWithMiniapp', ['$event']]]]]" lang="zh_CN"></button>
            <view @tap="__e" class="stop-login-c" :data-event-opts="[['tap', [['stopLogin', ['$event']]]]]"></view>
        </view>
        <get-phone-popup
            @__l="
                __l($event, {
                    eventOpts: [
                        ['^success', [['getPhoneNumberSuccess']]],
                        ['^cancel', [['e0']]]
                    ]
                })
            "
            @cancel="
                __e($event, {
                    eventOpts: [
                        ['^success', [['getPhoneNumberSuccess']]],
                        ['^cancel', [['e0']]]
                    ]
                })
            "
            @success="
                __e($event, {
                    eventOpts: [
                        ['^success', [['getPhoneNumberSuccess']]],
                        ['^cancel', [['e0']]]
                    ]
                })
            "
            :data-event-opts="[
                ['^success', [['getPhoneNumberSuccess']]],
                ['^cancel', [['e0']]]
            ]"
            vueId="6b4b36ba-2"
            v-if="isShowPhonePopup"
        ></get-phone-popup>
    </view>
</template>

<script>
import userStatementFalse from '@/components/UserStatementFalse/UserStatementFalse';
import getPhonePopup from '@/components/GetPhonePopup/GetPhonePopupForWechat';
import tabBar from '@/components/TabBar/tabBar';
(global.webpackJsonp = global.webpackJsonp || []).push([
    ['pages/login/index'],
    {
        '00a3': function (e, t, n) {},
        '34c1': function (e, t, n) {
            'use strict';

            n.d(t, 'b', function () {
                return i;
            });
            n.d(t, 'c', function () {
                return a;
            });
            n.d(t, 'a', function () {
                return o;
            });
            var o = {
                UserStatementFalse: function () {
                    return n.e('components/UserStatementFalse/UserStatementFalse').then(n.bind(null, '3c88'));
                },
                GetPhonePopup: function () {
                    return n.e('components/GetPhonePopup/GetPhonePopup').then(n.bind(null, 'fc3f'));
                }
            };
            var i = function () {
                var that = this;
                that.$createElement;
                that._self._c;
                that._isMounted ||
                    (that.e0 = function (t) {
                        that.isShowPhonePopup = false;
                    });
            };
            var a = [];
        },
        '3c8c': function (e, t, n) {
            'use strict';

            n.r(t);
            var o = n('9cf3');
            var i = n.n(o);
            for (var a in o) {
                if (['default'].indexOf(a) < 0) {
                    (function (e) {
                        n.d(t, e, function () {
                            return o[e];
                        });
                    })(a);
                }
            }
            t.default = i.a;
        },
        '7ebf': function (e, t, n) {
            'use strict';

            (function (e, t) {
                var o = n('4ea4');
                n('18ba');
                o(n('66fd'));
                var i = o(n('9421'));
                e.__webpack_require_UNI_MP_PLUGIN__ = n;
                t(i.default);
            }.call(this, n('bc2e').default, n('543d').createPage));
        },
        9421: function (e, t, n) {
            'use strict';

            n.r(t);
            var o = n('34c1');
            var i = n('3c8c');
            for (var a in i) {
                if (['default'].indexOf(a) < 0) {
                    (function (e) {
                        n.d(t, e, function () {
                            return i[e];
                        });
                    })(a);
                }
            }
            n('d0a2');
            var c = n('f0c5');
            var r = Object(c.a)(i.default, o.b, o.c, false, null, null, null, false, o.a, void 0);
            t.default = r.exports;
        },
        '9cf3': function (e, t, n) {
            'use strict';

            (function (e, o) {
                var i = n('4ea4');
                Object.defineProperty(t, '__esModule', {
                    value: true
                });
                t.default = void 0;
                var a = i(n('9523'));
                var c = n('cbb4');
                function r(e, t) {
                    var n = Object.keys(e);
                    if (Object.getOwnPropertySymbols) {
                        var o = Object.getOwnPropertySymbols(e);
                        if (t) {
                            o = o.filter(function (t) {
                                return Object.getOwnPropertyDescriptor(e, t).enumerable;
                            });
                        }
                        n.push.apply(n, o);
                    }
                    return n;
                }
                var s = {
                    name: 'login',
                    components: {
                        GetPhonePopup: function () {
                            n.e('components/GetPhonePopup/GetPhonePopupForWechat')
                                .then(
                                    function () {
                                        return resolve(n('cb40'));
                                    }.bind(null, n)
                                )
                                .catch(n.oe);
                        }
                    },
                    data: function () {
                        return {
                            code: '',
                            params: {},
                            isShowPhonePopup: false,
                            dataUuid: '',
                            isLoginLoading: false,
                            isCheckUserStatement: true,
                            isuser_info: false
                        };
                    },
                    created: function () {
                        this.getCode();
                    },
                    onShow: function () {
                        var t = (0, c.$getStorage)('token');
                        if (t) {
                            console.log('token====>' + t);
                            setTimeout(function (t) {
                                e.navigateBack({
                                    delta: 1
                                });
                            }, 100);
                        }
                    },
                    computed: {
                        logo: function () {
                            return this.$store.getters.setting.login_page.logo || '';
                        },
                        bgImage: function () {
                            return this.$store.getters.setting.login_page.bg_image || '';
                        }
                    },
                    methods: {
                        getCode: function () {
                            var that = this;
                            e.login({
                                success: function (e) {
                                    console.log('logon ====>', e);
                                    that.code = e.code;
                                },
                                fail: function (e) {
                                    console.log(e);
                                }
                            });
                        },
                        getUserInfoWithMiniapp: function () {
                            var that = this;
                            return this.isCheckUserStatement
                                ? !this.isLoginLoading &&
                                      ((this.isLoginLoading = true),
                                      void o.getUserProfile({
                                          desc: '用于完善会员资料',
                                          success: function (e) {
                                              console.log(e);
                                              if ((0, c.$getStorage)('click_id')) {
                                                  that.params = {
                                                      code: that.code,
                                                      encrypt_data: e.encryptedData,
                                                      iv: e.iv,
                                                      click_id: (0, c.$getStorage)('click_id')
                                                  };
                                              } else {
                                                  that.params = {
                                                      code: that.code,
                                                      encrypt_data: e.encryptedData,
                                                      iv: e.iv
                                                  };
                                              }
                                              that.submitLogin(that.params);
                                          },
                                          complete: function () {
                                              that.isLoginLoading = false;
                                          }
                                      }))
                                : (e.showToast({
                                      title: '请先阅读并同意《用户使用协议》',
                                      icon: 'none'
                                  }),
                                  false);
                        },
                        getPhoneNumberSuccess: function (e) {
                            this.params = (function (e) {
                                for (var t = 1; t < arguments.length; t++) {
                                    if (null != arguments[t]) {
                                        var n = arguments[t];
                                    } else {
                                        var n = {};
                                    }
                                    t % 2
                                        ? r(Object(n), true).forEach(function (t) {
                                              (0, a.default)(e, t, n[t]);
                                          })
                                        : Object.getOwnPropertyDescriptors
                                        ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n))
                                        : r(Object(n)).forEach(function (t) {
                                              Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
                                          });
                                }
                                return e;
                            })(
                                {
                                    data_uuid: this.dataUuid
                                },
                                e
                            );
                            if ((0, c.$getStorage)('click_id')) {
                                this.params.click_id = (0, c.$getStorage)('click_id');
                            }
                            if ((0, c.$getStorage)('weixinadinfo')) {
                                this.params.weixinadinfo = (0, c.$getStorage)('weixinadinfo');
                            }
                            this.isuser_info = true;
                            this.submitLogin(this.params);
                        },
                        stopLogin: function () {
                            (0, c.$setStorage)('stop_login_time', new Date().getTime());
                            e.switchTab({
                                url: '/pages/index/index'
                            });
                        },
                        submitLogin: function (t) {
                            var that = this;
                            e.showLoading({
                                title: '登录中'
                            });
                            if ((0, c.$getStorage)('click_id')) {
                                t.click_id = (0, c.$getStorage)('click_id');
                            }
                            return this.$store
                                .dispatch('login', {
                                    type: 'with-wechat',
                                    params: t
                                })
                                .then(function (t) {
                                    e.hideLoading();
                                    t.data.is_need_phone_number || t.data.is_need_phone
                                        ? ((that.isShowPhonePopup = true), (that.dataUuid = t.data.data_uuid), that.getCode())
                                        : t.data.token &&
                                          (that.$store.dispatch('getUserInfo'),
                                          t.data.is_first_login
                                              ? e.redirectTo({
                                                    url: '/pages/myProfile/index'
                                                })
                                              : e.navigateBack({
                                                    delta: 1
                                                }));
                                });
                        }
                    }
                };
                t.default = s;
            }.call(this, n('543d').default, n('bc2e').default));
        },
        d0a2: function (e, t, n) {
            'use strict';

            var o = n('00a3');
            n.n(o).a;
        }
    },
    [['7ebf', 'common/runtime', 'common/vendor']]
]);
</script>
<style>
@import './index.css';
</style>
